<html>
<head><meta charset="utf-8"><title>getrusage mac os x weirdness · t-compiler/shrinkmem-sprint · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/276895-t-compiler/shrinkmem-sprint/index.html">t-compiler/shrinkmem-sprint</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage.20mac.20os.20x.20weirdness.html">getrusage mac os x weirdness</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227510168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage%20mac%20os%20x%20weirdness/near/227510168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage.20mac.20os.20x.20weirdness.html#227510168">(Feb 23 2021 at 21:55)</a>:</h4>
<p>I’m now wondering if RUSAGE_CHILDREN is just broken, at least for maxrss, on Mac OS X.</p>



<a name="227510335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage%20mac%20os%20x%20weirdness/near/227510335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage.20mac.20os.20x.20weirdness.html#227510335">(Feb 23 2021 at 21:56)</a>:</h4>
<p>Like, my code seems to do the right thing on Linux, but even after correcting for the bytes/kb confusion on mac os x, I still see output like this: </p>
<div class="codehilite"><pre><span></span><code>[RUSTC-TIMING] crossbeam_utils test:false 1.490 user: 1.415677 sys: 0.70062 max rss (kb): 111239168 page reclaims: 29329 page faults: 0 voluntary ctxt switches: 12 involuntary ctxt switches: 810
</code></pre></div>



<a name="227510553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage%20mac%20os%20x%20weirdness/near/227510553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage.20mac.20os.20x.20weirdness.html#227510553">(Feb 23 2021 at 21:58)</a>:</h4>
<p>Or this one</p>
<div class="codehilite"><pre><span></span><code>[RUSTC-TIMING] core test:false 36.903 user: 35.842394 sys: 1.361294 max rss (kb): 1230303232 page reclaims: 434827 page faults: 0 voluntary ctxt switches: 265 involuntary ctxt switches: 42471
</code></pre></div>



<a name="227511588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage%20mac%20os%20x%20weirdness/near/227511588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage.20mac.20os.20x.20weirdness.html#227511588">(Feb 23 2021 at 22:02)</a>:</h4>
<p>at some point i’m going to have to give up and resort to sampling rss via <code>ps -o rss</code></p>



<a name="227516753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage%20mac%20os%20x%20weirdness/near/227516753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage.20mac.20os.20x.20weirdness.html#227516753">(Feb 23 2021 at 22:34)</a>:</h4>
<p>macOS <code>time</code> seems to use <code>proc_pid_rusage</code> instead of <code>getrusage</code> <a href="https://opensource.apple.com/source/shell_cmds/shell_cmds-216.60.1/time/time.c.auto.html">https://opensource.apple.com/source/shell_cmds/shell_cmds-216.60.1/time/time.c.auto.html</a></p>



<a name="227528842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage%20mac%20os%20x%20weirdness/near/227528842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage.20mac.20os.20x.20weirdness.html#227528842">(Feb 24 2021 at 00:25)</a>:</h4>
<p>I really should, at the very least, add a <code>getrusage(RUSAGE_SELF, …)</code> call to the <code>rustc</code> binary itself, and compare the numbers it yields to what the <code>rustc</code> shim is producing for <code>getrusage(RUSAGE_CHILDREN, …)</code></p>



<a name="228225536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage%20mac%20os%20x%20weirdness/near/228225536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/276895-t-compiler/shrinkmem-sprint/topic/getrusage.20mac.20os.20x.20weirdness.html#228225536">(Mar 01 2021 at 13:00)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/276895-t-compiler.2Fshrinkmem-sprint/topic/getrusage.20mac.20os.20x.20weirdness/near/227528842">said</a>:</p>
<blockquote>
<p>I really should, at the very least, add a <code>getrusage(RUSAGE_SELF, …)</code> call to the <code>rustc</code> binary itself, and compare the numbers it yields to what the <code>rustc</code> shim is producing for <code>getrusage(RUSAGE_CHILDREN, …)</code></p>
</blockquote>
<p>I did this experiment, and I believe I disconfirmed the above hypothesis that the broken-ness is contained to <code>RUSAGE_CHILDREN</code>. That is: I saw similar weirdness when using <code>RUSAGE_SELF</code> just on the <code>rustc</code> binary.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>